<template>
  <el-table :data="list">
    <el-table-column label="编码" prop="coding" />
    <el-table-column label="名称" prop="name" />
    <el-table-column label="优先程度" prop="priority">
      <template v-slot="{row}">{{ priority[row.priority] }}</template>
    </el-table-column>
    <el-table-column label="类别" prop="category">
      <template v-slot="{row}">{{ category[row.category] }}</template>
    </el-table-column>
    <el-table-column label="专业" prop="profession">
      <template v-slot="{row}">{{ profession[row.profession] }}</template>
    </el-table-column>
    <el-table-column label="上次执行" prop="prev_execute" />
    <el-table-column label="下一个日期" prop="next_date" />
  </el-table>
</template>

<script>
import { profession, priority, category } from '../../../utils/options'
import API from '../../../api/project/plan'
export default {
  name: 'EquipmentPlan',
  props: {
    value: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      profession,
      priority,
      category,
      list: []
    }
  },
  watch: {
    value() {
      this.index()
    }
  },
  created() {
    this.index()
  },
  methods: {
    index() {
      API.index({ equipment_id: this.value }).then(response => {
        this.list = response.data.data
      })
    }
  }
}
</script>
